home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / mpss / cross.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-07-20  |  5.4 KB  |  192 lines

  1.  
  2. /*******************************************************************************
  3. ********************************************************************************
  4. ********************************************************************************
  5.  
  6. PERMISSION TO COPY THIS SOFTWARE IS HEREBY GIVEN BY THE AUTHOR PROVIDED THAT
  7. THIS LEADING MESSAGE IS INCLUDED IN ALL OF THE RELEVANT SOURCE FILES.
  8.  
  9.         P. SCHMITZ, UNIVERSITY OF KEELE, MAY 1988.
  10.  
  11.  
  12. ********************************************************************************
  13. ********************************************************************************
  14. *******************************************************************************/
  15.  
  16. #include "header.h"
  17.  
  18. drawcross(cp)
  19. register struct player *cp;
  20. {
  21. int i;
  22.  
  23. for(i=1;i<10;++i)
  24. {
  25. poscurs(cp,20,i);
  26. write(cp->fd, "                            |                            ",57); 
  27. }
  28. poscurs(cp,20,10);
  29. write(cp->fd, "---------------------------   ---------------------------",57); 
  30. for (i=11;i<20;++i)
  31. {
  32. poscurs(cp,20,i);
  33. write(cp->fd, "                            |                            ",57); 
  34. }
  35. plotvitals(cp);
  36. }
  37.  
  38.  
  39. plotvitals(cp)
  40. register struct player *cp;
  41. {
  42. int x1,x2,y1,y2,xx1,xx2,yy1,yy2;
  43. cp->xvel=0;cp->yvel=0;
  44. x1=cp->xpos-28;
  45. x2=x1+57;
  46. y1=cp->ypos-9;
  47. y2=y1+19;
  48. plot_screen(cp,x1,x2,y1,y2);
  49. }
  50.  
  51.  
  52. plot_screen(cp,x1,x2,y1,y2)
  53. register struct player *cp;
  54. register int x1,x2,y1,y2;
  55. {
  56. register int xnew,ynew;
  57. register char c;
  58.     
  59.     int xx;
  60.  
  61.     plotposition(cp);
  62.  
  63.     for (i=y1; i<y2; ++i)
  64.         {
  65.         if ((xp=univ[i])==NULL) continue;
  66.         do
  67.         {
  68.         if (((xx=xp->x)>=x1)&&(xx<=x2))
  69.             {
  70.         l=19-(i-y1);
  71.         k=20+(xx-x1);
  72.         if((k>19)&&(l>0)&&(k<77)&&(l<20))
  73.                 {
  74.                 poscurs(cp,k,l);
  75.                 write(cp->fd,&(xp->c),1);
  76.                 }
  77.             } 
  78.         if (xx>x2) xp=NULL;
  79.                else 
  80.                xp=xp->next_thing;
  81.         }  while (xp!=NULL);
  82.         } 
  83.     
  84.     player=startlist;
  85.  
  86.     while (player!=NULL)
  87.     {
  88.     if (cp==player)
  89.             {
  90.             player=player->next;
  91.             continue;
  92.             }
  93. xnew=player->xpos;
  94. ynew=player->ypos;
  95. if (!(((c=inuniv(xnew,ynew))=='*')||(c=='O')||(c=='.')||(c=='@')))
  96.      {
  97.             if (player->cloakingdevice==OFF)
  98.             {
  99.       if (player->stat<12)
  100.     {
  101.     l=19-(ynew-y1);
  102.     if(((k=20+(xnew-x1))>19)&&(l>0)&&(k<77)&&(l<20))
  103.                     {
  104.                     poscurs(cp,k,l);
  105.                     write(cp->fd,&(player->id),1);
  106.                     }
  107.                 }
  108.             }
  109.     }
  110.     player=player->next;
  111.     }
  112. }
  113.    
  114. drawconsole(cp)
  115. register struct player *cp;
  116. {
  117. int i,j;
  118.  
  119. poscurs(cp,19,0); 
  120. write(cp->fd,"******************MULTI-PLAYER-STAR-TREK*******************",59);
  121. poscurs(cp,19,20); 
  122. write(cp->fd,"********************MESSAGE WINDOW :***********************",59); 
  123. poscurs(cp,19,23); 
  124. write(cp->fd,"***********************************************************",59); 
  125. for (i=1;  i<24; ++i) { poscurs(cp,19,i);
  126.                 write(cp->fd,"*",1); }
  127. for (i=1;  i<24; ++i) { poscurs(cp,77,i); 
  128.                 write(cp->fd,"*",1); }
  129. poscurs(cp,1,0); write(cp->fd,"SHIP'S  STATUS :",16);
  130. poscurs(cp,1,1); write(cp->fd,"~~~~~~~~~~~~~~~~",16);
  131. poscurs(cp,1,3); write(cp->fd,"QUAD:",5);
  132. poscurs(cp,1,5); write(cp->fd,"WARP:",5);
  133. poscurs(cp,1,7); write(cp->fd,"ENERGY (CU's):",14);
  134. poscurs(cp,1,9); write(cp->fd,"MAX. ENERGY  :",14);
  135. poscurs(cp,1,11);write(cp->fd,"WEAPONS STATUS :",16);
  136. poscurs(cp,1,12);write(cp->fd,"~~~~~~~~~~~~~~~~",16);
  137. poscurs(cp,1,14);write(cp->fd,"CLOAKING DEV.:",14);
  138. poscurs(cp,2,16);write(cp->fd,"SHIELDS :",9);
  139. poscurs(cp,1,18);write(cp->fd,"PHASER BANKS:",13);
  140. poscurs(cp,1,19);write(cp->fd,"RANGE:",6);
  141. poscurs(cp,10,19);write(cp->fd,"MAX:",4);
  142. poscurs(cp,1,20);write(cp->fd,"PHOTON TORPS:",13);
  143. poscurs(cp,1,21);write(cp->fd,"RANGE:",6);
  144. poscurs(cp,10,21);write(cp->fd,"MAX:",4);
  145. poscurs(cp,1,22);write(cp->fd,"STATUS:",7);
  146. poscurs(cp,1,23);write(cp->fd,"SCORE :",7);
  147. }
  148.  
  149. display_sheet(cp)
  150. register struct player *cp;
  151. {
  152. poscurs(cp,20,1);
  153. write(cp->fd, "~~~~~~~~~~~~~HELP FUNCTION & COMMAND SUMMARY~~~~~~~~~~~~~",57);
  154. poscurs(cp,20,2);
  155. write(cp->fd, "h,j,k,l => WARP DRIVE: left, down, up, right, movements. ",57); 
  156. poscurs(cp,20,3);
  157. write(cp->fd, "y,u,b,n => WARP DRIVE: diagonal movements. s => full stop",57); 
  158. poscurs(cp,20,4);
  159. write(cp->fd, " H,J,K,L,Y,U,B,N => Manoevering impulse engine movements ",57); 
  160. poscurs(cp,20,5);
  161. write(cp->fd, "   o => orbit, i => impulse thrusters to cancel orbit    ",57); 
  162. poscurs(cp,20,6);
  163. write(cp->fd, "      + => Quit, G => beep on/off, R => Redraw Screen    ",57); 
  164. poscurs(cp,20,7);
  165. write(cp->fd, "d,f => dock/undock, 1..9 => fire weapon, p => weapon sel.",57); 
  166. poscurs(cp,20,8);
  167. write(cp->fd, "    q => show quadrant, w => show warp, e => show energy ",57); 
  168. poscurs(cp,20,9);
  169. write(cp->fd, "      c => cloaking device on/off, v => shields on/off   ",57); 
  170. poscurs(cp,20,10);
  171. write(cp->fd, " t<1,2,3,4> => lock tractor beam, T => show tractor beams",57); 
  172. poscurs(cp,20,11);
  173. write(cp->fd, "  W => who is playing?, a<1,2,3,4> => auto-pilot to beam ",57); 
  174. poscurs(cp,20,12);
  175. write(cp->fd, " C<A> => Com link/send message, P<A> => send Prefix code ",57); 
  176. poscurs(cp,20,13);
  177. write(cp->fd, " S<A> => Scan ship on/off  (This will show prefix codes.)",57); 
  178. poscurs(cp,20,14);
  179. write(cp->fd, "   z => beam to/from planet,  ? => this help function.   ",57); 
  180. poscurs(cp,20,15);
  181. write(cp->fd, "                  Key to command notation :              ",57); 
  182. poscurs(cp,20,16);
  183. write(cp->fd, "       <1,2,3,4> => a number between 1-4 inclusive,      ",57);
  184. poscurs(cp,20,17);
  185. write(cp->fd, "    <A> => a shipname in the form of a lower case letter ",57); 
  186. poscurs(cp,20,18);
  187. write(cp->fd, "NB : If a function doesn't seem to work, you cannot do it",57); 
  188. poscurs(cp,20,19);
  189. write(cp->fd, "while you are in that particular status. PRESS ANY KEY ->",57); 
  190. }
  191.  
  192.